package zxltest;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import zxltest.mapper.Demo01Mapper;

import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Demo01
 */
public class Demo01 {
    public static void main(String[] args) throws Exception {
        String resource = "mybatis.xml";
        InputStream inputStream = Resources.getResourceAsStream(resource);
        SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
        SqlSession sqlSession = sqlSessionFactory.openSession();
        Demo01Mapper mapper = sqlSession.getMapper(Demo01Mapper.class);
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("Sno", 201215123);
        List<Map<String, Object>> maps = mapper.selectAll(map);
        System.out.println(maps);
    }
}
